package com.yywz.observerpattern;

import java.util.ArrayList;
import java.util.List;

public class ConcreteSubject implements Subject{
	
	private List<Observer> observerList = new ArrayList<Observer>();
	
	@Override
	public void registerObserver(Observer observer) {
		observerList.add(observer);
	}

	@Override
	public void removeObserver(Observer observer) {
		observerList.remove(observer);
	}

	@Override
	public void notifyObservers() {
		for (Observer observer : observerList) {
			observer.update();
		}
	}

}
